package com.huirui.server.pojo.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.io.Serial;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;

@Data
@Schema(description = "优惠券数据传输对象，用于优惠券相关的前后端数据交互")
public class CouponDto implements Serializable {

    @Schema(description = "优惠券 ID")
    private Long id;

    @Schema(description = "优惠券名字")
    private String name;

    @Schema(description = "优惠券发放开始时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime distributionStartTime;

    @Schema(description = "优惠券发放结束时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime distributionEndTime;

    @Schema(description = "优惠券类型，0 - 通用券，1 - 品类券，2 商品券")
    private Integer couponType;

    @Schema(description = "关联分类 ID，逗号隔开")
    private List<Long> categoryIds;

    @Schema(description = "关联商品 ID，逗号隔开")
    private List<Long> productIds;

    @Schema(description = "优惠券面额")
    private BigDecimal denomination;

    @Schema(description = "是否有使用门槛，0 - 无门槛，1 - 有门槛")
    private Integer hasThreshold;

    @Schema(description = "使用门槛")
    private BigDecimal threshold;

    @Schema(description = "有效期类型，0 - 领取后 N 天有效，1 - 某一个时间有效")
    private Integer expiryType;

    @Schema(description = "有效天数")
    private Integer validDays;

    @Schema(description = "有效开始时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime availableStartTime;

    @Schema(description = "有效结束时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime availableEndTime;

    @Schema(description = "是否有数量限制，0 - 无数量限制，1 - 有数量限制")
    private Integer hasQuantityLimit;

    @Schema(description = "数量限制（如果有）")
    private Integer quantityLimit;

    @Schema(description = "优惠券已发放总量")
    private Long distributedQuantity;

    @Schema(description = "优惠券待发放总量")
    private Long pendingDistributionQuantity;

    @Schema(description = "用户最大领取限制")
    private Integer userMaxCollectionLimit;

    @Schema(description = "优惠券状态，0 - 正常，1 - 关闭，2 - 过期，3 - 删除")
    private Integer couponStatus;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Schema(description = "优惠券创建时间")
    private LocalDateTime createTime;
    @Schema(description = "优惠券更改时间")
    private LocalDateTime updateTime;
    @Serial
    private static final long serialVersionUID = 1L;
}